import 'package:winkai/generated/json/base/json_convert_content.dart';
import 'package:winkai/entity/mse_rpy_rsp.dart';

MsgRpyRsp $MsgRpyRspFromJson(Map<String, dynamic> json) {
  final MsgRpyRsp msgRpyRsp = MsgRpyRsp();
  final int? convId = jsonConvert.convert<int>(json['conv_id']);
  if (convId != null) {
    msgRpyRsp.convId = convId;
  }
  final String? msgId = jsonConvert.convert<String>(json['msg_id']);
  if (msgId != null) {
    msgRpyRsp.msgId = msgId;
  }
  final MsgRpyRspAnswer? answer = jsonConvert.convert<MsgRpyRspAnswer>(
      json['answer']);
  if (answer != null) {
    msgRpyRsp.answer = answer;
  }
  return msgRpyRsp;
}

Map<String, dynamic> $MsgRpyRspToJson(MsgRpyRsp entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['conv_id'] = entity.convId;
  data['msg_id'] = entity.msgId;
  data['answer'] = entity.answer?.toJson();
  return data;
}

extension MsgRpyRspExtension on MsgRpyRsp {
  MsgRpyRsp copyWith({
    int? convId,
    String? msgId,
    MsgRpyRspAnswer? answer,
  }) {
    return MsgRpyRsp()
      ..convId = convId ?? this.convId
      ..msgId = msgId ?? this.msgId
      ..answer = answer ?? this.answer;
  }
}

MsgRpyRspAnswer $MsgRpyRspAnswerFromJson(Map<String, dynamic> json) {
  final MsgRpyRspAnswer msgRpyRspAnswer = MsgRpyRspAnswer();
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    msgRpyRspAnswer.content = content;
  }
  final String? source = jsonConvert.convert<String>(json['source']);
  if (source != null) {
    msgRpyRspAnswer.source = source;
  }
  final String? lockLevel = jsonConvert.convert<String>(json['lock_level']);
  if (lockLevel != null) {
    msgRpyRspAnswer.lockLevel = lockLevel;
  }
  final MsgRpyRspAnswerAnalysis? analysis = jsonConvert.convert<
      MsgRpyRspAnswerAnalysis>(json['analysis']);
  if (analysis != null) {
    msgRpyRspAnswer.analysis = analysis;
  }
  return msgRpyRspAnswer;
}

Map<String, dynamic> $MsgRpyRspAnswerToJson(MsgRpyRspAnswer entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['content'] = entity.content;
  data['source'] = entity.source;
  data['lock_level'] = entity.lockLevel;
  data['analysis'] = entity.analysis?.toJson();
  return data;
}

extension MsgRpyRspAnswerExtension on MsgRpyRspAnswer {
  MsgRpyRspAnswer copyWith({
    String? content,
    String? source,
    String? lockLevel,
    MsgRpyRspAnswerAnalysis? analysis,
  }) {
    return MsgRpyRspAnswer()
      ..content = content ?? this.content
      ..source = source ?? this.source
      ..lockLevel = lockLevel ?? this.lockLevel
      ..analysis = analysis ?? this.analysis;
  }
}

MsgRpyRspAnswerAnalysis $MsgRpyRspAnswerAnalysisFromJson(
    Map<String, dynamic> json) {
  final MsgRpyRspAnswerAnalysis msgRpyRspAnswerAnalysis = MsgRpyRspAnswerAnalysis();
  final bool? askPhoto = jsonConvert.convert<bool>(json['ask_photo']);
  if (askPhoto != null) {
    msgRpyRspAnswerAnalysis.askPhoto = askPhoto;
  }
  return msgRpyRspAnswerAnalysis;
}

Map<String, dynamic> $MsgRpyRspAnswerAnalysisToJson(
    MsgRpyRspAnswerAnalysis entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['ask_photo'] = entity.askPhoto;
  return data;
}

extension MsgRpyRspAnswerAnalysisExtension on MsgRpyRspAnswerAnalysis {
  MsgRpyRspAnswerAnalysis copyWith({
    bool? askPhoto,
  }) {
    return MsgRpyRspAnswerAnalysis()
      ..askPhoto = askPhoto ?? this.askPhoto;
  }
}